package com.lin.sqltool.factory;




import com.lin.sqltool.service.AIService;
import com.lin.sqltool.service.ConnectionService;
import com.lin.sqltool.service.impl.MySQLConnectionServiceImpl;
import com.lin.sqltool.service.impl.ZhiPuAIServiceImpl;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public class AIServiceFactory {


    private static final ConcurrentMap<String, AIService> SERVICES = new ConcurrentHashMap<>();

    static {
        // 初始化已知数据库类型的服务实例
        SERVICES.put("智普清言", new ZhiPuAIServiceImpl());

    }

    public static AIService getService(String aiType) {
        // 检查缓存中是否存在实例
        AIService service = SERVICES.get(aiType);
        if (service == null) {
            throw new IllegalArgumentException("不支持的AI类型: " + aiType);
        }
        return service;
    }

    public static AIService getService() {
        return getService("智普清言");
    }

}
